[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
dostounix() Convert Date and Time to UNIX Time Format
#include <dos.h>
long dostounix(dateptr,timeptr);
struct date *dateptr; Pointer to date structure
struct time *timeptr; Pointer to time structure
dostounix() converts a date and time into UNIX format--the number of
seconds since midnight, January 1, 1970 (GMT). 'dateptr' and
'timeptr' point respectively to a date and a time structure, both of
which must contain valid DOS date and time information.
The date and time can be obtained from getdate() and gettime().
Returns: The UNIX version of current time
Portability: MS-DOS only.
-------------------------------- Example ---------------------------------
The following statements produce a UNIX format time from the DOS date
and time.
#include <dos.h>
main()
{
long unixtime;
struct date dosdate;
struct time dostime;
char *st_time;
getdate(&dosdate);
gettime(&dostime);
unixtime = dostounix(&dosdate,&dostime);
st_time = ctime(&unixtime);
printf("The date and time is %s\n",st_time);
}
See Also:
ctime()
getdate()
gettime()
unixtodos()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson